home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / binutils / arlex.l < prev    next >
Text File  |  1992-05-27  |  2KB  |  83 lines

  1. %{
  2. /* arlex.l - Strange script language lexer */
  3.  
  4. /*   Copyright (C) 1992 Free Software Foundation, Inc.
  5.  
  6. This file is part of GNU Binutils.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program; if not, write to the Free Software
  20. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22.  
  23. /* Contributed by Steve Chamberlain
  24.              sac@cygnus.com
  25.  
  26. */
  27. #define DONTDECLARE_MALLOC
  28. #include <ansidecl.h>
  29. #include "arparse.h"
  30. extern char *strdup();
  31. int linenumber;
  32. %}
  33. %%
  34.  
  35. "ADDLIB"       { return ADDLIB; }
  36. "ADDMOD"       { return ADDMOD; }
  37. "CLEAR"       { return CLEAR; }
  38. "CREATE"       { return CREATE; }
  39. "DELETE"       { return DELETE; }
  40. "DIRECTORY"       { return DIRECTORY; }
  41. "END"       { return END; }
  42. "EXTRACT"       { return EXTRACT; }
  43. "FULLDIR"       { return FULLDIR; }
  44. "HELP"       { return HELP; }
  45. "LIST"        { return LIST; }
  46. "OPEN"       { return OPEN; }
  47. "REPLACE"       { return REPLACE; }
  48. "VERBOSE"       { return VERBOSE; }
  49. "SAVE"       { return SAVE; }
  50. "addlib"       { return ADDLIB; }
  51. "addmod"       { return ADDMOD; }
  52. "clear"       { return CLEAR; }
  53. "create"       { return CREATE; }
  54. "delete"       { return DELETE; }
  55. "directory"       { return DIRECTORY; }
  56. "end"       { return END; }
  57. "extract"       { return EXTRACT; }
  58. "fulldir"       { return FULLDIR; }
  59. "help"       { return HELP; }
  60. "list"        { return LIST; }
  61. "open"       { return OPEN; }
  62. "replace"       { return REPLACE; }
  63. "verbose"       { return VERBOSE; }
  64. "save"       { return SAVE; }
  65. "+\n"           { linenumber ++; }
  66. "("             { return '('; }
  67. ")"             { return ')'; }
  68. ","             { return ','; }
  69. [A-Za-z0-9/$:.\-\_]+  {     
  70.         yylval.name =  strdup(yytext);
  71.         return FILENAME;
  72.         }
  73. "*".*         { }
  74. ";".*         { }
  75. " "        { }
  76. "\n"          { linenumber ++; return NEWLINE; }    
  77.  
  78. %%
  79. #ifndef yywrap
  80. /* Needed for lex, though not flex. */
  81. int yywrap() { return 1; }
  82. #endif
  83.